//
//  WSSubscribeCell.m
//  CharonTVProject
//
//  Created by karong on 2023/8/10.
//

#import "WSSubscribeCell.h"
#import "WSThreeColorGradientColorView.h"
#import "UIView+WSDraw.h"
#import "WSGoods.h"

@interface WSSubscribeCell ()
@property (weak, nonatomic) IBOutlet WSThreeColorGradientColorView *mainView;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *priceLabel;
@property (weak, nonatomic) IBOutlet UILabel *desLabel;
@property (weak, nonatomic) IBOutlet UIImageView *tagImageView;

@end

@implementation WSSubscribeCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [self.mainView setCornerWithLeftTopCorner:11 rightTopCorner:27.5 bottomLeftCorner:11 bottomRightCorner:11];
}

- (void)setDataWithObject:(WSGoods *)object select:(BOOL)select {
    self.titleLabel.text = object.title;
    self.priceLabel.text = WSSF(@"$%.2f", object.price);
    self.desLabel.text = object.vip_activity_desc;
    [self setDiscountStatusWithObject:object];
    [self setSelectStatus:select];
}

- (void) setDiscountStatusWithObject:(WSGoods *)object {
    if (WSIsNullOrEmpty(object.vip_activity_tag)) {
        self.tagImageView.hidden = YES;
    }
    else {
        self.tagImageView.hidden = NO;
    }
}

- (void)setSelectStatus:(BOOL)select {
    UIColor * titleColor = select?[UIColor colorFromHexRGB:@"6A3E26"]:UIColor.font_white_ffffff;
    UIColor * priceColor = select?[UIColor colorFromHexRGB:@"FF5A00"]:[UIColor colorFromHexRGB:@"F8D6BD"];
    UIColor * descColor = select?[UIColor colorFromHexRGB:@"6A3E26"]:[UIColor colorFromHexRGB:@"66667B"];
    self.titleLabel.textColor = titleColor;
    self.priceLabel.textColor = priceColor;
    self.desLabel.textColor = descColor;
    UIColor * color1 = select?[UIColor colorFromHexRGB:@"F6CCB1"]:[UIColor colorFromHexRGB:@"31344A"];
    UIColor * color2 = select?[UIColor colorFromHexRGB:@"FFFCFB"]:[UIColor colorFromHexRGB:@"31344A"];
    UIColor * color3 = select?[UIColor colorFromHexRGB:@"F7D8C0"]:[UIColor colorFromHexRGB:@"3A3D55"];
    [self.mainView resetCorlor1:color1 color2:color2 color3:color3];
}
@end
